import React from 'react'
import { AppContext } from './App'

const withContext = (Component) => (
  (props) => {
    <AppContext.Consumer>
      {({ state }) => (
        <Component {...props} data={state} />
      )}
    </AppContext.Consumer>
  }
)

export default withContext